<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    // 下面代码有bug，会有栈溢出的问题，是否正确
    document.querySelector('.box').innerHTML = new Date().toLocaleString()
    function getCurrentTime() {
      document.querySelector('.box').innerHTML = new Date().toLocaleString()
      setTimeout(getCurrentTime, 1000)
    }
    getCurrentTime()
  </script>
</body>
</html>